#ifndef _LINK_H_
#define _LINK_H_

#include "resource.h"
#include "filechecker.h"

class Link : public Resource {
	private:
		const char *lat_trace;
		const char *lat_error;
		const char *bw_trace;
		const char *bw_error;
		const char *bw_lim_trace;

		const char *lat_forecast;
		const char *bw_forecast;
		const char *bw_lim_forecast;
		
		SG_Trace forecast_lat;
		SG_Trace forecast_lat_error;
		SG_Trace forecast_bw;
		SG_Trace forecast_bw_error;
		SG_Trace forecast_bw_lim;

	public:
		static const long double MINIMUM_LATENCY = 0.0000000001;
		/*Constructor using traces*/
		Link(const char *name, const char *lat, long double lat_offset, const char *bw, long double bw_offset, const char *bw_lim, long double bw_lim_offset, const char *lat_error, const char *bw_error, const char *lat_forecast=NULL, const char *bw_forecast=NULL, const char *bw_lim_forecast=NULL);
		/*Constructor using fixed values*/		
		Link(const char *name, long double lat,  long double bw, long double bw_lim);	
		/*Destructor*/
		~Link();
		/*Gets the latency in a given time t */
		long double getLatency(long double time);
		/*Gets the bandwidth in a given time t */
		long double getBandwidth(long double time);
		/*Gets the bandwidth limit in a given time t */
		long double getBandwidthLimit(long double time);				

		long double getBandwidthAvailable(long double time);
		
		long double getLatencyError(long double time);
		long double getBandwidthError(long double time);
		
		/*Get latency trace file name*/
		const char *getLatencyTrace();
		const char *getLatencyError();
		const char *getLatencyForecast();
		/*Get lbandwidth trace file name*/
		const char *getBandwidthTrace();
		const char *getBandwidthError();
		const char *getBandwidthForecast();		
		/*Get bandwidth limit trace file name*/
		const char *getBandwidthLimitTrace();
		const char *getBandwidthLimitForecast();
		
		/*Get and Set the latency offset*/
		long double getLatencyOffset();
		void setLatencyOffset(long double new_offset);
		/*Get and Set the bandwidth offset*/
		long double getBandwidthOffset();
		void setBandwidthOffset(long double new_offset);		
		/*Get and Set the bandwidth limit offset*/
		long double getBandwidthLimitOffset();		
		void setBandwidthLimitOffset(long double new_offset);		
		
};

#endif //_LINK_H_
